package com.chen.demo.chater3.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chen.demo.chater3.domain.User;
import com.chen.demo.chater3.service.UserService;

@RestController
public class UserController {
	@Autowired 
	private UserService userService;
	
	@RequestMapping("/findAll")
	public List<User> findAll(){
		System.out.println(userService.findAll());
		return userService.findAll();
	}
	@RequestMapping("/getById/{id}")
	public User getById(@PathVariable int id){
		System.out.println(id);
		return userService.findById(id);
	}
}
